package com.itheima.thread.utils.countdownlatch.demo01;

import java.util.concurrent.CountDownLatch;

public class CountDownLatchDemo {

    public static void main(String[] args) {

        CountDownLatch countDownLatch = new CountDownLatch(2);

        CountDownLatchThread01 countDownLatchThread01 = new CountDownLatchThread01(countDownLatch);
        CountDownLatchThread02 countDownLatchThread02 = new CountDownLatchThread02(countDownLatch);

        Thread t1 = new Thread(countDownLatchThread01);
        Thread t2 = new Thread(countDownLatchThread02);

        t1.start();
        t2.start();

        try {
            countDownLatch.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("主线程执行了...程序结束了...");

    }
}
